$('title').html('付钱拉_帮助中心');

var meta = '<meta name="keywords" content="帮助中心"><meta name="description" content="帮助中心是付钱拉的大百科全书：配置参数，通道申请，费用相关，资金清算，接入开发，服务端问题等均有详细的资料供您查询。">';
$('head').append(meta);

$(".back").hover(function() {
            $(".page-error").toggleClass('hover');
});
        
        
        
var baseUrl = "https://service.fuqian.la";
/**
 * 处理当前用户登录状态，登录或者未登录
 */
function loadLoginStatus(){
    $.ajax({
        url: baseUrl + "/merchuser/auth/loginInfo.do",
        data: {},
        type: "get",
        dataType: "jsonp",
        contentType: "application/json; charset=utf-8",
        success: function (res) {
            // console.log("res:", res);
            if(res.retcode && res.retcode == "200"){
                $(".has_login").show();
                $(".no_login").hide();
            }else{
                $(".has_login").hide();
                $(".no_login").show();
            }
        },
        error: function (xhr, ajaxOptions, thrownError) {
            console.log("error ...", xhr.status);
        }
    });
}

/**
 * 退出登录
 */
function logout(){
    var outUrl = baseUrl + "/merchuser/anon/logout.do";
    if(confirm('请确认,您要退出登录吗？')){
        doLogoutAjax(outUrl,"jsonp","get", function () {});
    }
}

function doLogoutAjax(url,dataType,type,onError){
    $.ajax({
        url: url,
        dataType: dataType,
        contentType: "application/json; charset=utf-8",
        type: type,
        success: function(res){
            if(res.retcode && res.retcode == "200"){
                $(".has_login").hide();
                $(".no_login").show();
                window.location = "http://fuqian.la/index.html";
            }
        },
        error: onError
    });
}

    //移除侧边栏默认按钮，绑定自定义按钮事件
    function supportBoxRemove() {
      window.KF5SupportBoxAPI.ready(function () {
        window.KF5SupportBoxAPI.removeButton();
      });
      $(document).on('click', '#sidebarfixed li:eq(0)', function () {
        window.KF5SupportBoxAPI.open();
      });
    }
    
    //显示或者隐藏去顶部的按钮
    function goTopShow(){
      let scrollHeight = $doc.scrollTop();
      if (scrollHeight > winHeight) {
        $("#sidebarfixed").addClass("go-top");
      } else {
        $("#sidebarfixed").removeClass("go-top");
      }
    }

    let $body = $('body');
    let $doc = $(document);
    let $win = $(window);
    let winHeight = $win.height();

//$(function(){
    //当前页面是否是登录状态
    loadLoginStatus();

    //退出
    $("#quit").on("click", logout);
    
    //移除侧边栏默认按钮，绑定自定义按钮事件
    supportBoxRemove();
    
    goTopShow();
    $('#goTop').click(function(){
      $('html, body').animate({ scrollTop: 0 }, 'slow');
    });
    $(window).scroll(function(e){
      goTopShow();
    });
//});
        